<?php


abstract class BasePeer extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $info_hash;


	
	protected $ip4_1;


	
	protected $ip4_2;


	
	protected $ip4_3;


	
	protected $ip4_4;


	
	protected $ip4_port;


	
	protected $ip6_1;


	
	protected $ip6_2;


	
	protected $ip6_3;


	
	protected $ip6_4;


	
	protected $ip6_5;


	
	protected $ip6_6;


	
	protected $ip6_7;


	
	protected $ip6_8;


	
	protected $ip6_port;


	
	protected $onion;


	
	protected $stats;


	
	protected $bytes_uploaded;


	
	protected $bytes_upload_offset;


	
	protected $bytes_download_offset;


	
	protected $bytes_left;


	
	protected $agent;


	
	protected $created_at;


	
	protected $updated_at;


	
	protected $finished_at;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getInfoHash()
	{

		return $this->info_hash;
	}

	
	public function getIp41()
	{

		return $this->ip4_1;
	}

	
	public function getIp42()
	{

		return $this->ip4_2;
	}

	
	public function getIp43()
	{

		return $this->ip4_3;
	}

	
	public function getIp44()
	{

		return $this->ip4_4;
	}

	
	public function getIp4Port()
	{

		return $this->ip4_port;
	}

	
	public function getIp61()
	{

		return $this->ip6_1;
	}

	
	public function getIp62()
	{

		return $this->ip6_2;
	}

	
	public function getIp63()
	{

		return $this->ip6_3;
	}

	
	public function getIp64()
	{

		return $this->ip6_4;
	}

	
	public function getIp65()
	{

		return $this->ip6_5;
	}

	
	public function getIp66()
	{

		return $this->ip6_6;
	}

	
	public function getIp67()
	{

		return $this->ip6_7;
	}

	
	public function getIp68()
	{

		return $this->ip6_8;
	}

	
	public function getIp6Port()
	{

		return $this->ip6_port;
	}

	
	public function getOnion()
	{

		return $this->onion;
	}

	
	public function getStats()
	{

		return $this->stats;
	}

	
	public function getBytesUploaded()
	{

		return $this->bytes_uploaded;
	}

	
	public function getBytesUploadOffset()
	{

		return $this->bytes_upload_offset;
	}

	
	public function getBytesDownloadOffset()
	{

		return $this->bytes_download_offset;
	}

	
	public function getBytesLeft()
	{

		return $this->bytes_left;
	}

	
	public function getAgent()
	{

		return $this->agent;
	}

	
	public function getCreatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->created_at === null || $this->created_at === '') {
			return null;
		} elseif (!is_int($this->created_at)) {
						$ts = strtotime($this->created_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
			}
		} else {
			$ts = $this->created_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getUpdatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->updated_at === null || $this->updated_at === '') {
			return null;
		} elseif (!is_int($this->updated_at)) {
						$ts = strtotime($this->updated_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true));
			}
		} else {
			$ts = $this->updated_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getFinishedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->finished_at === null || $this->finished_at === '') {
			return null;
		} elseif (!is_int($this->finished_at)) {
						$ts = strtotime($this->finished_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [finished_at] as date/time value: " . var_export($this->finished_at, true));
			}
		} else {
			$ts = $this->finished_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function setId($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = PeerPeer::ID;
		}

	} 
	
	public function setInfoHash($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->info_hash !== $v) {
			$this->info_hash = $v;
			$this->modifiedColumns[] = PeerPeer::INFO_HASH;
		}

	} 
	
	public function setIp41($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip4_1 !== $v) {
			$this->ip4_1 = $v;
			$this->modifiedColumns[] = PeerPeer::IP4_1;
		}

	} 
	
	public function setIp42($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip4_2 !== $v) {
			$this->ip4_2 = $v;
			$this->modifiedColumns[] = PeerPeer::IP4_2;
		}

	} 
	
	public function setIp43($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip4_3 !== $v) {
			$this->ip4_3 = $v;
			$this->modifiedColumns[] = PeerPeer::IP4_3;
		}

	} 
	
	public function setIp44($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip4_4 !== $v) {
			$this->ip4_4 = $v;
			$this->modifiedColumns[] = PeerPeer::IP4_4;
		}

	} 
	
	public function setIp4Port($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip4_port !== $v) {
			$this->ip4_port = $v;
			$this->modifiedColumns[] = PeerPeer::IP4_PORT;
		}

	} 
	
	public function setIp61($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip6_1 !== $v) {
			$this->ip6_1 = $v;
			$this->modifiedColumns[] = PeerPeer::IP6_1;
		}

	} 
	
	public function setIp62($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip6_2 !== $v) {
			$this->ip6_2 = $v;
			$this->modifiedColumns[] = PeerPeer::IP6_2;
		}

	} 
	
	public function setIp63($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip6_3 !== $v) {
			$this->ip6_3 = $v;
			$this->modifiedColumns[] = PeerPeer::IP6_3;
		}

	} 
	
	public function setIp64($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip6_4 !== $v) {
			$this->ip6_4 = $v;
			$this->modifiedColumns[] = PeerPeer::IP6_4;
		}

	} 
	
	public function setIp65($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip6_5 !== $v) {
			$this->ip6_5 = $v;
			$this->modifiedColumns[] = PeerPeer::IP6_5;
		}

	} 
	
	public function setIp66($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip6_6 !== $v) {
			$this->ip6_6 = $v;
			$this->modifiedColumns[] = PeerPeer::IP6_6;
		}

	} 
	
	public function setIp67($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip6_7 !== $v) {
			$this->ip6_7 = $v;
			$this->modifiedColumns[] = PeerPeer::IP6_7;
		}

	} 
	
	public function setIp68($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip6_8 !== $v) {
			$this->ip6_8 = $v;
			$this->modifiedColumns[] = PeerPeer::IP6_8;
		}

	} 
	
	public function setIp6Port($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->ip6_port !== $v) {
			$this->ip6_port = $v;
			$this->modifiedColumns[] = PeerPeer::IP6_PORT;
		}

	} 
	
	public function setOnion($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->onion !== $v) {
			$this->onion = $v;
			$this->modifiedColumns[] = PeerPeer::ONION;
		}

	} 
	
	public function setStats($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->stats !== $v) {
			$this->stats = $v;
			$this->modifiedColumns[] = PeerPeer::STATS;
		}

	} 
	
	public function setBytesUploaded($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->bytes_uploaded !== $v) {
			$this->bytes_uploaded = $v;
			$this->modifiedColumns[] = PeerPeer::BYTES_UPLOADED;
		}

	} 
	
	public function setBytesUploadOffset($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->bytes_upload_offset !== $v) {
			$this->bytes_upload_offset = $v;
			$this->modifiedColumns[] = PeerPeer::BYTES_UPLOAD_OFFSET;
		}

	} 
	
	public function setBytesDownloadOffset($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->bytes_download_offset !== $v) {
			$this->bytes_download_offset = $v;
			$this->modifiedColumns[] = PeerPeer::BYTES_DOWNLOAD_OFFSET;
		}

	} 
	
	public function setBytesLeft($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->bytes_left !== $v) {
			$this->bytes_left = $v;
			$this->modifiedColumns[] = PeerPeer::BYTES_LEFT;
		}

	} 
	
	public function setAgent($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->agent !== $v) {
			$this->agent = $v;
			$this->modifiedColumns[] = PeerPeer::AGENT;
		}

	} 
	
	public function setCreatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->created_at !== $ts) {
			$this->created_at = $ts;
			$this->modifiedColumns[] = PeerPeer::CREATED_AT;
		}

	} 
	
	public function setUpdatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->updated_at !== $ts) {
			$this->updated_at = $ts;
			$this->modifiedColumns[] = PeerPeer::UPDATED_AT;
		}

	} 
	
	public function setFinishedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [finished_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->finished_at !== $ts) {
			$this->finished_at = $ts;
			$this->modifiedColumns[] = PeerPeer::FINISHED_AT;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getString($startcol + 0);

			$this->info_hash = $rs->getString($startcol + 1);

			$this->ip4_1 = $rs->getInt($startcol + 2);

			$this->ip4_2 = $rs->getInt($startcol + 3);

			$this->ip4_3 = $rs->getInt($startcol + 4);

			$this->ip4_4 = $rs->getInt($startcol + 5);

			$this->ip4_port = $rs->getInt($startcol + 6);

			$this->ip6_1 = $rs->getInt($startcol + 7);

			$this->ip6_2 = $rs->getInt($startcol + 8);

			$this->ip6_3 = $rs->getInt($startcol + 9);

			$this->ip6_4 = $rs->getInt($startcol + 10);

			$this->ip6_5 = $rs->getInt($startcol + 11);

			$this->ip6_6 = $rs->getInt($startcol + 12);

			$this->ip6_7 = $rs->getInt($startcol + 13);

			$this->ip6_8 = $rs->getInt($startcol + 14);

			$this->ip6_port = $rs->getInt($startcol + 15);

			$this->onion = $rs->getString($startcol + 16);

			$this->stats = $rs->getString($startcol + 17);

			$this->bytes_uploaded = $rs->getString($startcol + 18);

			$this->bytes_upload_offset = $rs->getString($startcol + 19);

			$this->bytes_download_offset = $rs->getString($startcol + 20);

			$this->bytes_left = $rs->getString($startcol + 21);

			$this->agent = $rs->getString($startcol + 22);

			$this->created_at = $rs->getTimestamp($startcol + 23, null);

			$this->updated_at = $rs->getTimestamp($startcol + 24, null);

			$this->finished_at = $rs->getTimestamp($startcol + 25, null);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 26; 
		} catch (Exception $e) {
			throw new PropelException("Error populating Peer object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(PeerPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			PeerPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
    if ($this->isNew() && !$this->isColumnModified(PeerPeer::CREATED_AT))
    {
      $this->setCreatedAt(time());
    }

    if ($this->isModified() && !$this->isColumnModified(PeerPeer::UPDATED_AT))
    {
      $this->setUpdatedAt(time());
    }

		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(PeerPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = PeerPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setNew(false);
				} else {
					$affectedRows += PeerPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = PeerPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}



			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = PeerPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getInfoHash();
				break;
			case 2:
				return $this->getIp41();
				break;
			case 3:
				return $this->getIp42();
				break;
			case 4:
				return $this->getIp43();
				break;
			case 5:
				return $this->getIp44();
				break;
			case 6:
				return $this->getIp4Port();
				break;
			case 7:
				return $this->getIp61();
				break;
			case 8:
				return $this->getIp62();
				break;
			case 9:
				return $this->getIp63();
				break;
			case 10:
				return $this->getIp64();
				break;
			case 11:
				return $this->getIp65();
				break;
			case 12:
				return $this->getIp66();
				break;
			case 13:
				return $this->getIp67();
				break;
			case 14:
				return $this->getIp68();
				break;
			case 15:
				return $this->getIp6Port();
				break;
			case 16:
				return $this->getOnion();
				break;
			case 17:
				return $this->getStats();
				break;
			case 18:
				return $this->getBytesUploaded();
				break;
			case 19:
				return $this->getBytesUploadOffset();
				break;
			case 20:
				return $this->getBytesDownloadOffset();
				break;
			case 21:
				return $this->getBytesLeft();
				break;
			case 22:
				return $this->getAgent();
				break;
			case 23:
				return $this->getCreatedAt();
				break;
			case 24:
				return $this->getUpdatedAt();
				break;
			case 25:
				return $this->getFinishedAt();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = PeerPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getInfoHash(),
			$keys[2] => $this->getIp41(),
			$keys[3] => $this->getIp42(),
			$keys[4] => $this->getIp43(),
			$keys[5] => $this->getIp44(),
			$keys[6] => $this->getIp4Port(),
			$keys[7] => $this->getIp61(),
			$keys[8] => $this->getIp62(),
			$keys[9] => $this->getIp63(),
			$keys[10] => $this->getIp64(),
			$keys[11] => $this->getIp65(),
			$keys[12] => $this->getIp66(),
			$keys[13] => $this->getIp67(),
			$keys[14] => $this->getIp68(),
			$keys[15] => $this->getIp6Port(),
			$keys[16] => $this->getOnion(),
			$keys[17] => $this->getStats(),
			$keys[18] => $this->getBytesUploaded(),
			$keys[19] => $this->getBytesUploadOffset(),
			$keys[20] => $this->getBytesDownloadOffset(),
			$keys[21] => $this->getBytesLeft(),
			$keys[22] => $this->getAgent(),
			$keys[23] => $this->getCreatedAt(),
			$keys[24] => $this->getUpdatedAt(),
			$keys[25] => $this->getFinishedAt(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = PeerPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setInfoHash($value);
				break;
			case 2:
				$this->setIp41($value);
				break;
			case 3:
				$this->setIp42($value);
				break;
			case 4:
				$this->setIp43($value);
				break;
			case 5:
				$this->setIp44($value);
				break;
			case 6:
				$this->setIp4Port($value);
				break;
			case 7:
				$this->setIp61($value);
				break;
			case 8:
				$this->setIp62($value);
				break;
			case 9:
				$this->setIp63($value);
				break;
			case 10:
				$this->setIp64($value);
				break;
			case 11:
				$this->setIp65($value);
				break;
			case 12:
				$this->setIp66($value);
				break;
			case 13:
				$this->setIp67($value);
				break;
			case 14:
				$this->setIp68($value);
				break;
			case 15:
				$this->setIp6Port($value);
				break;
			case 16:
				$this->setOnion($value);
				break;
			case 17:
				$this->setStats($value);
				break;
			case 18:
				$this->setBytesUploaded($value);
				break;
			case 19:
				$this->setBytesUploadOffset($value);
				break;
			case 20:
				$this->setBytesDownloadOffset($value);
				break;
			case 21:
				$this->setBytesLeft($value);
				break;
			case 22:
				$this->setAgent($value);
				break;
			case 23:
				$this->setCreatedAt($value);
				break;
			case 24:
				$this->setUpdatedAt($value);
				break;
			case 25:
				$this->setFinishedAt($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = PeerPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setInfoHash($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setIp41($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setIp42($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setIp43($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setIp44($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setIp4Port($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setIp61($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setIp62($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setIp63($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setIp64($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setIp65($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setIp66($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setIp67($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setIp68($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setIp6Port($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setOnion($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setStats($arr[$keys[17]]);
		if (array_key_exists($keys[18], $arr)) $this->setBytesUploaded($arr[$keys[18]]);
		if (array_key_exists($keys[19], $arr)) $this->setBytesUploadOffset($arr[$keys[19]]);
		if (array_key_exists($keys[20], $arr)) $this->setBytesDownloadOffset($arr[$keys[20]]);
		if (array_key_exists($keys[21], $arr)) $this->setBytesLeft($arr[$keys[21]]);
		if (array_key_exists($keys[22], $arr)) $this->setAgent($arr[$keys[22]]);
		if (array_key_exists($keys[23], $arr)) $this->setCreatedAt($arr[$keys[23]]);
		if (array_key_exists($keys[24], $arr)) $this->setUpdatedAt($arr[$keys[24]]);
		if (array_key_exists($keys[25], $arr)) $this->setFinishedAt($arr[$keys[25]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(PeerPeer::DATABASE_NAME);

		if ($this->isColumnModified(PeerPeer::ID)) $criteria->add(PeerPeer::ID, $this->id);
		if ($this->isColumnModified(PeerPeer::INFO_HASH)) $criteria->add(PeerPeer::INFO_HASH, $this->info_hash);
		if ($this->isColumnModified(PeerPeer::IP4_1)) $criteria->add(PeerPeer::IP4_1, $this->ip4_1);
		if ($this->isColumnModified(PeerPeer::IP4_2)) $criteria->add(PeerPeer::IP4_2, $this->ip4_2);
		if ($this->isColumnModified(PeerPeer::IP4_3)) $criteria->add(PeerPeer::IP4_3, $this->ip4_3);
		if ($this->isColumnModified(PeerPeer::IP4_4)) $criteria->add(PeerPeer::IP4_4, $this->ip4_4);
		if ($this->isColumnModified(PeerPeer::IP4_PORT)) $criteria->add(PeerPeer::IP4_PORT, $this->ip4_port);
		if ($this->isColumnModified(PeerPeer::IP6_1)) $criteria->add(PeerPeer::IP6_1, $this->ip6_1);
		if ($this->isColumnModified(PeerPeer::IP6_2)) $criteria->add(PeerPeer::IP6_2, $this->ip6_2);
		if ($this->isColumnModified(PeerPeer::IP6_3)) $criteria->add(PeerPeer::IP6_3, $this->ip6_3);
		if ($this->isColumnModified(PeerPeer::IP6_4)) $criteria->add(PeerPeer::IP6_4, $this->ip6_4);
		if ($this->isColumnModified(PeerPeer::IP6_5)) $criteria->add(PeerPeer::IP6_5, $this->ip6_5);
		if ($this->isColumnModified(PeerPeer::IP6_6)) $criteria->add(PeerPeer::IP6_6, $this->ip6_6);
		if ($this->isColumnModified(PeerPeer::IP6_7)) $criteria->add(PeerPeer::IP6_7, $this->ip6_7);
		if ($this->isColumnModified(PeerPeer::IP6_8)) $criteria->add(PeerPeer::IP6_8, $this->ip6_8);
		if ($this->isColumnModified(PeerPeer::IP6_PORT)) $criteria->add(PeerPeer::IP6_PORT, $this->ip6_port);
		if ($this->isColumnModified(PeerPeer::ONION)) $criteria->add(PeerPeer::ONION, $this->onion);
		if ($this->isColumnModified(PeerPeer::STATS)) $criteria->add(PeerPeer::STATS, $this->stats);
		if ($this->isColumnModified(PeerPeer::BYTES_UPLOADED)) $criteria->add(PeerPeer::BYTES_UPLOADED, $this->bytes_uploaded);
		if ($this->isColumnModified(PeerPeer::BYTES_UPLOAD_OFFSET)) $criteria->add(PeerPeer::BYTES_UPLOAD_OFFSET, $this->bytes_upload_offset);
		if ($this->isColumnModified(PeerPeer::BYTES_DOWNLOAD_OFFSET)) $criteria->add(PeerPeer::BYTES_DOWNLOAD_OFFSET, $this->bytes_download_offset);
		if ($this->isColumnModified(PeerPeer::BYTES_LEFT)) $criteria->add(PeerPeer::BYTES_LEFT, $this->bytes_left);
		if ($this->isColumnModified(PeerPeer::AGENT)) $criteria->add(PeerPeer::AGENT, $this->agent);
		if ($this->isColumnModified(PeerPeer::CREATED_AT)) $criteria->add(PeerPeer::CREATED_AT, $this->created_at);
		if ($this->isColumnModified(PeerPeer::UPDATED_AT)) $criteria->add(PeerPeer::UPDATED_AT, $this->updated_at);
		if ($this->isColumnModified(PeerPeer::FINISHED_AT)) $criteria->add(PeerPeer::FINISHED_AT, $this->finished_at);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(PeerPeer::DATABASE_NAME);

		$criteria->add(PeerPeer::ID, $this->id);
		$criteria->add(PeerPeer::INFO_HASH, $this->info_hash);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		$pks = array();

		$pks[0] = $this->getId();

		$pks[1] = $this->getInfoHash();

		return $pks;
	}

	
	public function setPrimaryKey($keys)
	{

		$this->setId($keys[0]);

		$this->setInfoHash($keys[1]);

	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setIp41($this->ip4_1);

		$copyObj->setIp42($this->ip4_2);

		$copyObj->setIp43($this->ip4_3);

		$copyObj->setIp44($this->ip4_4);

		$copyObj->setIp4Port($this->ip4_port);

		$copyObj->setIp61($this->ip6_1);

		$copyObj->setIp62($this->ip6_2);

		$copyObj->setIp63($this->ip6_3);

		$copyObj->setIp64($this->ip6_4);

		$copyObj->setIp65($this->ip6_5);

		$copyObj->setIp66($this->ip6_6);

		$copyObj->setIp67($this->ip6_7);

		$copyObj->setIp68($this->ip6_8);

		$copyObj->setIp6Port($this->ip6_port);

		$copyObj->setOnion($this->onion);

		$copyObj->setStats($this->stats);

		$copyObj->setBytesUploaded($this->bytes_uploaded);

		$copyObj->setBytesUploadOffset($this->bytes_upload_offset);

		$copyObj->setBytesDownloadOffset($this->bytes_download_offset);

		$copyObj->setBytesLeft($this->bytes_left);

		$copyObj->setAgent($this->agent);

		$copyObj->setCreatedAt($this->created_at);

		$copyObj->setUpdatedAt($this->updated_at);

		$copyObj->setFinishedAt($this->finished_at);


		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
		$copyObj->setInfoHash(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new PeerPeer();
		}
		return self::$peer;
	}

} 